 *********************************************************************************************************************
Replication Files for: Geographic Representation and Requests for Federal Funds in the U.S. Senate

Jaclyn Kaslovsky (kjaclyn@wustl.edu) and Andrew R. Stone (arstone@olemiss.edu)
Washington University in St.Louis and University of Mississippi

This version: July 2024, v. 1.0

*********************************************************************************************************************

This repository contains the data and code necessary to replicate the analyses in the manuscript and online appendix.

The analysis was conducted in R (version 4.4.1) running on macOS Ventura (version 13.6.7). 

*********************************************************************************************************************

The following files are necessary to replicate the analyses in the article. 

*** Figures 1 and 3 ***

state_level_data.RData
state_level_analysis_main_text.R

*** Figures 2 and 4 ***

county_level_request_data.RData
county_level_request_analysis_main_text.R

*** Tables 1 and 3 ***

county_level_allocation_data.RData
county_level_allocation_analysis_main_text.R

*********************************************************************************************************************

The following files are necessary to replicate the analyses in the online appendix. 

*** Tables A.2, C.1, C.4, C.6, C.9, C.12, C.21 ***

state_level_data.RData
state_level_analysis_appendix.R

*** Tables A.1, A.3, C.2, C.5, C.7, C.10, C.11, C.13, C.14, C.15, C.16, C.19, C.22 ***

county_level_request_data.RData
county_level_request_analysis_appendix.R

*** Tables A.4, C.3, C.17, C.18, C.20, C.23, C.24, C.25 ***

county_level_allocation_data.RData
county_level_allocation_analysis_appendix.R

*** Table C.8 ***

state_level_data.RData
county_level_request_data.RData
table_c8_analysis_appendix.R

*** Figures C.1 and C.2 ***

county_level_allocation_data.RData
county_level_allocation_analysis_appendix.R

*********************************************************************************************************************

The following R packages are necessary to replicate the analyses in the article and online appendix. 

dplyr (version 1.1.4); ggplot2 (version 3.5.0); glmmTMB (version 1.1.9 -- check when loading if need to reinstall development version (?reinstalling)); gridExtra (version 2.3); lattice (version 0.21.8); lme4 (version 1.1-35.4); margins (version 0.3.26); Matrix (version 1.7-0); methods (version 4.4.1); mgcv (version 1.9-1); miceadds (version 3.16.18); nlme (version 3.1-165); numDeriv (version 2016.8-1.1); parameters (version 0.21.7); plyr (version 1.8.9); scales (version 1.3.0); stargazer (version 5.2.3); tidyverse (version 2.0.0); TMB (version 1.9.12); udpipe (version 0.8.11); xtable (version 1.8.4)

*********************************************************************************************************************

The following variables are used in the analyses found in the paper and appendix.

*** state_level_data.RData ***

senator: Senator name.
appropriation_sum: Sum of appropriations the senator requested.
party: Senator party.
logpop: Logged state population.
previous_vote_share: Senator vote share in previous election.
seniority: Senator seniority (number of Congresses as senator).
distance_from_dw_median: Senator distance from the DW-NOMINATE chamber median.
POPPCT_URBAN: Percentage of state population that is urban.
state.median.household.income: State median household income.
logpop_scaled: Standardized version of logged state population variable (mean 0, standard deviation 1).
previous_vote_share_scaled: Standardized version of previous vote share variable (mean 0, standard deviation 1).
seniority_scaled: Standardized version of seniority variable (mean 0, standard deviation 1).
distance_from_dw_median_scaled: Standardized version of senator distance from the DW-NOMINATE chamber median variable (mean 0, standard deviation 1).
POPPCT_URBAN_scaled: Standardized version of percentage of state population that is urban variable (mean 0, standard deviation 1).
state.median.household.income_scaled: Standardized version of state median household income variable (mean 0, standard deviation 1).
state.pct.poverty_scaled: Standardized measure of state population that is below the poverty line (mean 0, standard deviation 1).
logsum: Logged + 1 version of sum of appropriations the senator requested.
on_appropriations: Binary indicator for if the senator is on the Appropriations Committee.
female: Binary indicator for if the senator is female.
democrat: Binary indicator for if the senator is a Democrat.
party_leader: Binary indicator for if the senator is a party leader.
freshman: Binary indicator for if the senator is a freshman.
year: Year of observation.
no_request: Binary indicator for if the senator made no earmarks requests.
appropriation_count: Count of how many earmarks requests the senator made.
log_percap: Logged + 1 amount of senator appropriation requests per capita. 
state: Senator state.

*** county_level_request_data.RData ***
senator: Senator name.
state: Senator state.
county: County name.
GEOID: County geographic identifier.
appropriation_sum: Sum of appropriation requests made by the senator to the county.
other_sen_requested: Binary indicator for if the other senator also made a request to the county.
other_sen_sameparty: Binary indicator for if the other senator is of the same party.
log_sum: Logged + 1 sum of appropriation requests made by the senator to the county.
log_countypop: Logged + 1 county population.
on_appropriations: Binary indicator for if the senator is on the appropriations committee.
female: Binary indicator for if the senator is female.
dem: Binary indicator for if the senator is a Democrat.
core_county: Binary indicator for if the county is a senator's core county (if the senator received over 55 percent of the vote in the previous election).
swing_county: Binary indicator for if the county is a senator's swing county (if the senator received between 45 and 55 percent of the vote in the previous election).
seniority: Senator seniority (number of Congresses as senator).
party_leader:  Binary indicator for if the senator is a party leader.
meddist: Senator distance from the DW-NOMINATE chamber median.
freshman: Binary indicator for if the senator is a freshman.
pct_urban: Percentage of county population that is urban.
median_household_income: County median household income.
capital: Binary indicator for if the state capital is in the county.
year: Year of observation.
log_countypop_scaled: Standardized version of logged county population variable (mean 0, standard deviation 1).
seniority_scaled: Standardized version of seniority variable (mean 0, standard deviation 1).
meddist_scaled: Standardized version of senator distance from the DW-NOMINATE chamber median variable (mean 0, standard deviation 1).
pct_urban_scaled: Standardized version of percentage of county population that is urban variable (mean 0, standard deviation 1).
median_household_income_scaled: Standardized version of county median household income variable (mean 0, standard deviation 1).
opposition_county: Binary indicator for if the county is a senator's opposition county (if the senator received below 45 percent of the vote in the previous election).
logpercap: Logged + 1 amount of senator appropriation requests per capita.
total_sen_sum: Sum of appropriation requests senator made across all counties in the year.
log_sum_by_county: Logged + 1 sum of appropriation requests made by the senator to the county, dividing request totals by number of counties the request was targeted to.
same_partyvote_scaled: Standardized measure of vote share (continuous) senator received in the previous election (mean 0, standard deviation 1).
per_poverty_scaled: Standardized measure of percent of county population below poverty line (mean 0, standard deviation 1).
tercile_income: Tercile measure of county income as compared to other counties in state (coded low to high).
core_county2: Alternative measure of swing county (if the senator received over 57.5 percent of the vote in the previous election).
swing_county2: Alternative measure of swing county (if the senator received between 47.5 percent and 57.5 of the vote in the previous election).

*** county_level_allocation_data.RData ***
senator: Senator name.
year: Year of observation.
subcommittee: Appropriations subcommittee that the request was submitted to.
recipient: Recipient of earmark within the senator's state.
purpose: Stated purpose or description of earmark as laid out in the request.
amount: Amount of money requested for that earmark.
request_graned: A binary indicator for if the request was appropriated or not.
percent_request_fulfilled: Percent of the request that was allocated by the subcommittee.
amount_percapita: Amount of money requested divided by the total population of the affected counties.
log.total.requests.made: Logged amount of total requests submitted to the Appropriations Committee by the senator.
joint_request: Indicator for if the request was jointly submitted by the two senators.
num_counties: Number of counties affected by the request.
dem: Binary indicator for if the senator is a Democrat.
on_appropriations: Binary indicator for if the senator is on the appropriations committee.
meddist: Senator distance from the DW-NOMINATE chamber median.
mean_core_county: Average of the binary indicator core_county for if the affected counties are the senator's core counties (if the senator received over 55 percent of the vote in the previous election).
mean_swing_county: Average of the binary indicator swing_county for if the affected counties are the senator's swing counties (if the senator received between 45 and 55 percent of the vote in the previous election).
logpop: Logged +1 total population of affected counties.
female: Binary indicator for if the senator is female.
seniority: Senator seniority (number of Congresses as senator).
party_leader:  Binary indicator for if the senator is a party leader.
freshman: Binary indicator for if the senator is a freshman.
mean_pct_urban: Mean percentage of county population that is urban among the affected counties.
mean_median_household_income: Mean county median household income among the affected counties.
any_capital: Binary indicator for if the state capital is in any of the affected counties.
tercile_income: Max value of tercile measure of county income as compared to other counties in state (coded low to high) among the affected counties.
mean_per_poverty: Mean of percent of county population below poverty line among the affected counties.
mean_core_county_alt: Mean of alternative measure of swing county (if the senator received over 57.5 percent of the vote in the previous election) among the affected counties.
mean_swing_county_alt: Mean of alternative measure of swing county (if the senator received between 47.5 percent and 57.5 of the vote in the previous election) among the affected counties.
mean_same_partyvote: Mean of vote share (continuous) senator received in the previous election among the affected counties.
amount_percapita_scaled: Standardized version of amount_percapita (mean 0, standard deviation 1).
log.total.requests.made_sclaled: Standardized version of logged total request variable (mean 0, standard deviation 1).
num_counties_scaled: Standardized version of number of counties variable (mean 0, standard deviation 1).
mean_core_county_scaled: Standardized version of mean_core_county (mean 0, standard deviation 1).
mean_swing_county_scaled: Standardized version of mean_swing_county (mean 0, standard deviation 1).
logpop_scaled: Standardized version of logged county population variable (mean 0, standard deviation 1).
seniority_scaled: Standardized version of seniority variable (mean 0, standard deviation 1).
meddist_scaled: Standardized version of senator distance from the DW-NOMINATE chamber median variable (mean 0, standard deviation 1).
mean_pct_urban_scaled: Standardized version of mean percentage of county population that is urban variable (mean 0, standard deviation 1).
mean_median_household_income_scaled: Standardized version of mean county median household income variable (mean 0, standard deviation 1).
mean_same_partyvote_scaled: Standardized measure of mean vote share (continuous) senator received in the previous election (mean 0, standard deviation 1).
mean_per_poverty_scaled: Standardized measure of mean percent of county population below poverty line (mean 0, standard deviation 1).
mean_core_county_alt_scaled: Standardized measure of alternative measure of swing county (if the senator received over 57.5 percent of the vote in the previous election).
mean_swing_county_alt_scaled: Standardized measure of alternative measure of swing county (if the senator received between 47.5 percent and 57.5 of the vote in the previous election).

